//  Blitz image vision common utility header
//

//  Copyright Jeff Wong 2011

#ifndef BLITZ_IMAGE_VISION_COMMON_UTILITY_H
#define BLITZ_IMAGE_VISION_COMMON_UTILITY_H

#include "blitzdef.h"

#define PowerOf2(n)                   (((n)&((n)-1)) == 0)
#define RowStrideRound(stride, align) ((align)*(((stride)+(align)-1)/(align)))
#define DEGREE(x)                     ((x)*geometry::kRadian)
#define RADIAN(x)                     ((x)*geometry::kInvRadian)

#ifdef __cplusplus
namespace geometry {
#endif

template<class T>
inline T square(T x)
{
	return x*x;
}

extern void* aligned_malloc(size_t size, size_t align);
extern void aligned_free(void* memblock);

#ifdef __cplusplus
}
#endif

#endif /*MACHINE_VISION_COMMON_UTILITY_H*/